package cn.huoyingkeji.docapi.config;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;

/**
 * docapi配置
 */
@Configuration
public class SwaggerConfiguration {

    @Bean
    public OpenAPI springShopOpenAPI(){
        return new OpenAPI()
                // 接口文档标题
                .info(new Info().title("Sharpknife脚手架接口文档")
                        // 接口文档描述
                        .description("Sharpknife脚手架接口文档")
                        // 接口文档版本
                        .version("v1.0")
                        // 开发者联系方式
                        .contact(new Contact().name("514779463@qq.com").url("https://gitee.com/huoyingzhineng/sharpknife")))
                .externalDocs(new ExternalDocumentation()
                        // 额外补充说明
                        .description("代码托管gitee")
                        // 额外补充链接
                        .url("https://gitee.com/huoyingzhineng/sharpknife"));
    }

    @Bean
    public GroupedOpenApi systemApi() {
        return GroupedOpenApi.builder()
                .group("系统接口")
                .pathsToMatch("/system/**")
                .build();
    }

}
